from rest_framework.viewsets import ModelViewSet
from goods.models import GoodsChannel,GoodsCategory,GoodsChannelGroup
from meiduo_admin.my_paginate import MyPageNuberPagination
from meiduo_admin.channels.channels_serializers import GoodsChnnelsViewSerializers,ChnnelsTypeSerializer,ChnnelsCategoriesSerializer
from rest_framework.generics import ListAPIView


class GoodsChnnelsViewSet(ModelViewSet):
    pagination_class = MyPageNuberPagination
    serializer_class = GoodsChnnelsViewSerializers
    queryset = GoodsChannel.objects.all()


#频道组
class ChnnelsCategoriesViewSet(ListAPIView):
    serializer_class = ChnnelsCategoriesSerializer
    queryset = GoodsCategory.objects.filter(parent=None).all()
#一级分类
class ChnnelsTypeViewSet(ListAPIView):
    serializer_class = ChnnelsTypeSerializer
    queryset = GoodsChannelGroup.objects.all()
